using SharpGraphT.Graph.Builder;

namespace SharpGraphT.Graph;

public class DefaultUndirectedGraph<TV, TE> : AbstractBaseGraph<TV, TE>
    where TE : class, new() {
    private static readonly long SerialVersionUid = -2066644490824847621L;

    public DefaultUndirectedGraph() : this(null, () => new TE(), false) { }

    public DefaultUndirectedGraph(Func<TV> vertexSupplier,
        Func<TE> edgeSupplier, bool weighted) : base(vertexSupplier,
        edgeSupplier,
        new DefaultGraphType.Builder().Undirected().AllowMultipleEdges(false)
            .AllowSelfLoops(true).Weighted(weighted).Build()) { }

    public static GraphBuilder<TV, TE, DefaultUndirectedGraph<TV, TE>>
        CreateBuilder()  =>
        new(new DefaultUndirectedGraph<TV, TE>());

    public static GraphBuilder<TV, TE, DefaultUndirectedGraph<TV, TE>>
        CreateBuilder(Func<TE> edgeSupplier)  =>
        new(new DefaultUndirectedGraph<TV, TE>(null, edgeSupplier, false));
}